<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function multiplyByTwo(a,b,c){
            var i,
                ar = [];

            for (var i = 0; i < 3; i++) {
                ar[i] = arguments[i] * 2;
            }
            return ar;
        }

        function addOne(a){
            return a + 1;
        }

        console.log(multiplyByTwo(1,2,3));
        console.log(addOne(100));


        var myarr = [];
        // myarr = multiplyByTwo(10,20,30);
        //
        // for (var i = 0; i < myarr.length; i++) {
        //     myarr[i] = addOne(myarr[i]);
        // }
        // console.log(myarr);


        function multiplyByTwo(a, b, c, callback){
            var i,ar = [];
            for(i = 0;i < 3;i++){
                ar[i] = callback(arguments[i] * 2);
            }
            return ar;
        }

        myarr = multiplyByTwo(1,2,3,function(a){
            return a + 1;
        });
        console.log(myarr);
    </script>
</body>
</html>
